package com.zenika.zenbinding.sample.client;

import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TabPanel;
import com.zenika.zenbinding.client.util.BeanUtil;
import com.zenika.zenbinding.sample.model.City;
import com.zenika.zenbinding.sample.model.Person;

/**
 * @author Pierre Queinnec
 */
public class Sample {

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		FormulairePanel formulaire = new FormulairePanel();
		FormulairePanel2 formulaire2 = new FormulairePanel2();
		FormulairePanel3 formulaire3 = new FormulairePanel3();
		TablePanel table = new TablePanel();

		TabPanel tabPanel = new TabPanel();
		tabPanel.insert(formulaire, "Formulaire1", 0);
		tabPanel.insert(formulaire2, "Formulaire2", 1);
		tabPanel.insert(formulaire3, "Formulaire3", 2);
		tabPanel.insert(table, "Table", 3);

		RootPanel.get().add(tabPanel);

		City city = new City();
		city.setName("Barcelone");

		City city2 = (City) BeanUtil.clone(city);
		System.out.println(city);
		System.out.println(city2);

		Person person1 = new Person();
		person1.setCity(city2);

		Person person2 = (Person) BeanUtil.clone(person1);
		System.out.println(person1);
		System.out.println(person2);
	}

}
